<?php
	session_start();
	if(!isset($_SESSION["nick"]))
	{
		header("location: login.php");
	}
	echo "Bienvenido"." ".$_SESSION['nick'];
?>

<html>

	<head>
		<link href="elemento3.css" type="text/css" rel="stylesheet">
		<button><a href="login.php">cerrar sesion</a></button>
		<title>Krusty Burguer</title>
		
		<style type="text/css">
				body{
					color:#5A4848;
					background-image: url("fondo.png");
					background-repeat: no-repeat;
					background-position:0 0 0 0;
					opacity: 0.97;
				}
		</style>
	</head>  
	
	<body>
		<div id="cabecera">
			<h1>KRUSTY BURGUER</h1>
				<img id="logo" width='10%' height='10%' src='logo.gif'>
		</div>
		
		<div id="fecha">
			<b>
				<script type="text/javascript">
				/*Reloj de la pagina*/
				function startTime(){
				today=new Date();
				h=today.getHours();
				m=today.getMinutes();
				s=today.getSeconds();
				m=checkTime(m);
				s=checkTime(s);
				document.getElementById('reloj').innerHTML=h+":"+m+":"+s;
				t=setTimeout('startTime()',500);}
				function checkTime(i)
				{if (i<10) {i="0" + i;}return i;}
				window.onload=function(){startTime();}
				</script>

		<div id="reloj" style="font-size:20px;"></div>
			</b> 
		</div>

    
  
    <div id="menu">
    	<ul>
		<b>
        	<li><a href='epollos.php'>Inicio</a></li>
            <li><a href='epol_client.php?pagina=1'>Clientes</a></li>
            <li><a href='epol_product.php?pagina=1'>Producto</a></li>
            <li><a href='epol_pedidos.php?pagina=1'>Pedidos</a></li>
            <li><a href='epol_facturas.php?pagina=1'>Facturas</a></li>
			
		</b>
        </ul>
		</div>
    <div id="menu2">
        <h4>Indice</h4>
        <div >
         
            <li class="a"><a href='epol_client.php?pagina=1'>Clientes</a></li>
            <li class="b"><a href='epol_product.php?pagina=1'>Producto</a></li>
            <li class="c"><a href='epol_pedidos.php?pagina=1'>Pedidos</a></li>
            <li class="d"><a href='epol_facturas.php?pagina=1'>Facturas</a></li>
			
         
        </div>
    </div>
    
    <div id="centroprincipal">
    <?php
	  
$link = mysql_connect('localhost', "root")or die('No se pudo conectar: ' . mysql_error());
mysql_select_db('proyecto') or die('No se pudo seleccionar la base de datos');


$query = 'SELECT * FROM  facturas';
$result = mysql_query($query) or die('Consulta fallida: ' . mysql_error());


echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "<tr>";
    foreach ($line as $col_value) {
        echo "<td>$col_value</td>";
    }
	echo "<td><a href='epol_editar_facturas.php?cod=".$line['cod_factura']."'><img width='30' height='30' src='editar.jpg'></a></td>";
	echo "<td><a href='epol_eliminar_facturas.php?cod=".$line['cod_factura']."'><img width='30' height='30' src='eliminar.jpg'></a></td>";
    echo "</tr>";
}
echo "</table>\n";
echo "<td><a id='anadi' href='epol_anadido_producto.php'><img width='30' height='30' src='anadir.jpg'></a></td>";


mysql_free_result($result);

mysql_close($link);
	
	?>
    </div>   
        
    
   <div id="pie">
		
			 <p>
				<b>Producto registrado por la empresa moe s family.</b>
			</p>
			  
			<p>
		<script type="text/javascript">
			
			var date = new Date();
			var d  = date.getDate();
			var day = (d < 10) ? '0' + d : d;
			var m = date.getMonth() + 1;
			var month = (m < 10) ? '0' + m : m;
			var yy = date.getYear();
			var year = (yy < 1000) ? yy + 1900 : yy;
			document.write(day + "/" + month + "/" + year);
		
		</script>
			 </p>
			 
		</div>
	</body>
</html>